<template>
	<view>
  <view class="list">
    <view
      class="item"
      v-for="(item, index) in list"
      :key="index"
      @click="gotoPage(item.id)"
    >
      {{ item.station_Name }}
    </view>
  </view>
  <default-img msg="暂无洗车站" v-if="showDefault"></default-img>
  </view>
</template>
<script>
	
export default {
  data() {
    return {
      list: [],
	  showDefault: false, //是否显示默认图
    };
  },

  computed: {
    storeId() {
      return this.$store.state.userInfoDetail.store.storeId;
    },
  },

  onLoad() {
    this.getStationList();
  },

  methods: {
    gotoPage(id) {
      uni.navigateTo({
        url: "/pages_washCar/poster/couponPoster?siteId=" + id,
      });
    },

    //权限列表
    getStationList() {
      this.$api.washCar
        .getStationList({
          pageIndex: 1,
          pageSize: 100,
          storeid: this.storeId,
          ismanaged: true, //是否管理 true是已被管理列表
          mobile: this.$store.state.user.userInfo.mobile,
          isboss: this.$store.state.user.userInfo.role === '3' ? false : true, // 是否为子成员
		  isAll: this.$store.state.user.userInfo.role === '2' ? true : false, //是否为超级管理员
        })
        .then((res) => {
          console.log(res);
          if (res.data.list.length) {
            this.list = res.data.list;
          } else {
			  this.showDefault = true
			  }
        })
        .catch((err) => {
          console.log(err);
          uni.navigateBack();
        });
    },
  },
};
</script>
<style lang="scss" scoped>
.list {
  padding-top: 10rpx;

  .item {
    height: 110rpx;
    line-height: 110rpx;
    box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.1);
    font-size: 30rpx;
    font-weight: 500;
    color: #333333;
    margin-bottom: 10rpx;
    text-align: center;
  }
}
</style>
